package 程序.Lambda;
interface MathOne{
    int operation(int a, int b);
}
interface ServiceOne{
    void printMessage(String a);
}
public class 用Lambda表达式编写加减乘除功能 {
    public static void main(String[] args) {
        用Lambda表达式编写加减乘除功能 testlam = new 用Lambda表达式编写加减乘除功能();
        MathOne javfa =(int a,int b)->a+b;
        MathOne jianfafa =(int a,int b)->a-b;
        MathOne chengfa =(int a,int b)->{return a*b;};
        MathOne chufa =(int a,int b)->a/b;
        ServiceOne service=(MathOne)->System.out.println("hello!"+MathOne);
        System.out.println(testlam.operate(2,4,javfa));
        System.out.println(testlam.operate(2,4,jianfafa));
        System.out.println(testlam.operate(2,4,chengfa));
        System.out.println(testlam.operate(2,4,chufa));

    }
    private int operate(int a,int b,MathOne mathOne){
        return mathOne.operation(a,b);
    }
}
